<?php 
include('../../include/functions.inc.php');
include('../../include/inputbuilder.inc.v2.php');
include('../../include/maintenance.inc.php');
header('Content-Type: text/html; charset=iso-8859-1');

if(isEmpty(getParam('CARNET'))){
   echo 'WRONG PARAMETER';
}else{
$mStudents=&unserialize($_SESSION['mStudents']);

$builder=new InputBuilder();
$builder->db=$db;
$tabs=$db->query_select('cllg_table_tab',"TABLE_NAME='cllg_student'");
$rows=$db->query_select('cllg_student',sprintf("ID='%s'",getParam('CARNET')));
$row=$rows[0];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Nuevo Estudiante</title>
<link href="../../js_v2/jquery-ui-1.8.7.custom/development-bundle/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
<link href="../../css/maintenance_v2.css" rel="stylesheet" type="text/css" />
<script src="../../js_v2/jquery-ui-1.8.7.custom/js/jquery-1.4.4.min.js"></script>
<script src="../../js_v2/jquery-ui-1.8.7.custom/development-bundle/ui/jquery.ui.core.js"></script>
<script src="../../js_v2/jquery-ui-1.8.7.custom/development-bundle/ui/jquery.ui.widget.js"></script>
<script src="../../js_v2/jquery-ui-1.8.7.custom/development-bundle/ui/jquery.ui.button.js"></script>
<script src="../../js_v2/jquery-ui-1.8.7.custom/development-bundle/ui/jquery.ui.tabs.js"></script>
<script src="../../js_v2/jquery-ui-1.8.7.custom/development-bundle/ui/jquery.ui.datepicker.js"></script>

<script>	jQuery.noConflict();</script>
<script src="../../js/prototype.js" type="text/javascript"></script>
<script src="../../js/jsvalidate.js" type="text/javascript"></script>
<script src="../../js/maintenancev2.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
		jQuery("input:submit,input:button").button();
		jQuery("#tabs").tabs();
		jQuery("#BIRTH_DATE").datepicker();		
});
jQuery(document).ready(function(){
	<?php echo $mStudents->scriptValidations(); ?>
	jQuery()
});

</script>
</head>
<body>
<form id="<?php echo $mStudents->formName; ?>" name="<?php echo $mStudents->formName; ?>" method="GET" action="<?php echo $mStudents->saveNewUrlPage; ?>">
<div id="mant_head">
<div id="titulo">Mantenimiento Alumnos</div>
<div id="botones">
  <input type="submit" name="cmdOk" id="cmdOk" value="Aceptar"/>   
  <input type="submit" onclick="cancel(this.form,'index.php');" name="cmdCancel" id="cmdCancel" value="Cancelar" />
</div>
</div>
<div id="tabs">
  <ul>
	   <li><a href="#tab1">Informacion Principal</a></li>
       <li><a href="#tab2">Fotografia</a></li>
   <?php 
   	$ix=0;
	foreach($tabs as $t){ 
   	    $ix++; 
		$tabId="_tab_".$ix;
	?>
    <li ><a href="#<?php echo $tabId;?>"><?php echo $t["CAPTION"]; ?></a></li>
    <?php } ?>
  </ul>
  <div class="form-container" id="tab1">
  <fieldset>
  <div>
   <label for="ID"> * No. Carnet</label>
   <input name="ID" value="<?php echo $row["ID"]; ?>" readonly="readonly" type="text" id="ID" />
  </div>
    <div>
   <label for="FIRST_NAME"> * Nombres: </label>
			   <input name="FIRST_NAME" value="<?php echo $row["FIRST_NAME"]; ?>" type="text"  id="FIRST_NAME" size="30" maxlength="100" />
              -
              <input name="SECOND_NAME" value="<?php echo $row["SECOND_NAME"]; ?>" type="text" id="SECOND_NAME" size="30" maxlength="100" />
  </div>
  <div>
   <label for="LAST_NAME"> * Apellidos:</label>
   <input name="LAST_NAME"  type="text" id="LAST_NAME" size="60" maxlength="100" value="<?php echo $row["LAST_NAME"]; ?>" />            
  </div>
  <!--
  <div>
   <label for="GENDER"> * Sexo:</label>
   <select name="GENDER" size="1" id="GENDER">
      <option value="M" <?php if (!(strcmp($row["GENDER"], "M"))) {echo "selected=\"selected\"";} ?>>Masculino</option>
      <option value="F" <?php if (!(strcmp($row["GENDER"], "F"))) {echo "selected=\"selected\"";} ?>>Femenino</option>
   </select>
  </div> -->
  <div>
  <label for="BIRTH_DATE">Fecha de Nacimiento</label>
   <input name="BIRTH_DATE" readonly="readonly"  type="text" id="BIRTH_DATE" value="<?php echo date("Y/m/d",strtotime($row["BIRTHDATE"])); ?>" />
  </div>
  <input name="STATUS" type="hidden" id="STATUS" value="1" />
   <input name="operation" type="hidden" id="operation" value="u" />
  </fieldset>
  </div>

  <div class="form-container" id="tab2">
  <fieldset>
      <div>
      <label for="ARCHIVO">Seleccionar Archivo:</label>
       <input name="ARCHIVO" type="file" id="ARCHIVO" />
      </div>
      <div>
   	  <img src="../../img/ebook.jpg" width="468" height="339" alt="SDF" /></div>      
      </fieldset>
  </div>
   <?php $ix=0;
	foreach($tabs as $t){ 
   	    $ix++; ?>
    <div class="form-container" id="_tab_<?php echo $ix;?>">
        <fieldset> 
        <?php 
		$builder->build("cllg_student",$row['ID'],$t['ID']);
		?>  
        </fieldset>
  	</div>
 <?php } ?> 

  </div>
</div>
  </div>
<?php 
	$_SESSION['fields']=serialize($builder->fieldsArray);
?>
  </form>
</body>
</html>
<?php } ?>
